package com.xmy.cultivate.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xmy.cultivate.entity.BookOrder;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmy.cultivate.entity.BookStudent;
import com.xmy.cultivate.entity.request.BookClassTypeCountRs;
import com.xmy.cultivate.entity.request.BookSchoolCountRs;
import com.xmy.cultivate.entity.request.BookSchoolRs;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 * 教材订购管理 服务类
 * </p>
 *
 * @author hpiggy
 * @since 2025-01-04
 */
public interface IBookOrderService extends IService<BookOrder> {


    IPage<BookSchoolRs> getOrderSchool(IPage<?> page,
                                       Integer yearPart,
                                       Integer quarterNum,
                                       String subjectsId,
                                       String classTypeId,
                                       Integer lessonType,
                                       String schoolIdStr,
                                       Long bookTextId,
                                       Integer bookTextType,
                                       Integer isDetails,
                                       Long teacherId,
                                       Long schoolId,
                                       Integer yearClassId,
                                       String teacherName,
                                       String studentName,
                                       Integer lessonNum,
                                       Long gradeId,
                                       Integer subscribeType
    );

    List<BookClassTypeCountRs> getOrderSchoolCountForClassType(Integer yearPart,
                                                               Integer quarterNum,
                                                               String subjectsId,
                                                               String classTypeId,
                                                               Integer lessonType,
                                                               Long bookTextId,
                                                               Integer bookTextType,
                                                               Integer lessonNum,
                                                               Integer isDetails,
                                                               Integer subscribeType
    );

    IPage<BookSchoolRs> getYetOrderSchool(
            IPage<?> page,
            Long orderId,
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            Integer lessonType,
            Integer type,
            Integer status,
            Integer orderType,
            Integer orderSubType,
            String schoolIdStr,
            Long bookTextId,
            Integer bookTextType,
            Integer isDetails,
            Long teacherId,
            Long schoolId,
            Integer yearClassId,
            String teacherName,
            String studentName,
            Long gradeId,
            Integer subscribeType,
            Integer lessonNum
    );


    //获取教材发放
    List<BookSchoolRs> getDistributeOrderSchool(
            Long orderId,
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            Integer lessonType,
            Integer type,
            Integer status,
            Integer orderType,
            Integer orderSubType,
            Integer orderStatus,
            String schoolIdStr
    );


    IPage<BookSchoolRs> getDistributeOrderSchoolDetails(
            IPage<?> page,
            Long orderId,
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            String yearClassId,
            Integer lessonType,
            Integer type,
            Integer orderType,
            Integer orderSubType,
            Integer orderStatus,
            Integer disType,
            String schoolId,
            String teacherId,
            String idList,
            String teacherName,
            String studentName,
            Long gradeId,
            String schoolIdStr,
            Integer isDetails,
            Long bookTextId,
            Integer bookTextType,
            Integer subscribeType,
            Integer lessonNum
    );

    List<BookSchoolCountRs> getGrantCountList(
            Integer yearPart,
            Integer quarterNum,
            Long schoolId,
            String subjectsId,
            String classTypeId,
            String yearClassId,
            Integer lessonType,
            Long orderId,
            Integer type,
            Integer orderType,
            Integer orderSubType,
            Long teacherId,
            String teacherName,
            Integer disType,
            Integer isDetails,
            Long bookTextId,
            Integer bookTextType,
            Integer subscribeType,
            Integer lessonNum
    );


    IPage<BookSchoolRs> getRepertoryUnissuedList(
            IPage<?> page,
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            String yearClassId,
            Integer lessonType,
            String schoolId,
            String teacherName,
            String studentName,
            Long gradeId,
            Integer isDetails,
            Integer type,
            String idList,
            String schoolIdStr,
            Long bookTextId,
            Integer bookTextType,
            Long teacherId,
            Integer subscribeType,
            Integer lessonNum
    );


    public abstract List<BookSchoolCountRs> getRepertoryUnissuedCountList(
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            String yearClassId,
            Integer lessonType,
            Long schoolId,
            String teacherName,
            String studentName,
            Long gradeId,
            Integer isDetails,
            Integer type,
            Long bookTextId,
            Integer bookTextType,
            Long teacherId,
            Integer subscribeType,
            Integer lessonNum
    );

    public abstract BookStudent getNotIssued(
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            String yearClassId,
            Integer lessonType,
            Long schoolId,
            Long bookTextId
    );


    //下单详情
    IPage<BookSchoolRs> getYetOrderSchoolDetail(
            IPage<?> page,
            Long orderId,
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            Integer lessonType,
            Integer type,
            Integer status,
            Integer orderType,
            Integer orderSubType,
            String schoolIdStr,
            Integer bookTextType,
            Integer lessonNum,
            Integer subscribeType
    );

    List<BookClassTypeCountRs> getBookCountForClassType(
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            Integer lessonType,
            Integer status,
            Integer orderType,
            Integer orderSubType,
            Long bookTextId,
            Integer bookTextType,
            Integer subscribeType,
            Integer lessonNum
    );

    Integer addBookOrder(BookOrder bookOrder, String schoolIdStr);

    String getBatchName(Integer yearPart, Integer quarterNum, Long subjectsId, Long classTypeId, Integer bookTextType, Long bookTextId, Integer lessonNum, Integer subscribeType);

    Integer getMaxBatchNum(Integer yearPart, Integer quarterNum, Long subjectsId, Long classTypeId, Integer bookTextType, Long bookTextId, Integer lessonNum, Integer subscribeType);


    boolean placeOrder(BookOrder bookOrderParam, String schoolIdStr);

    IPage<BookSchoolRs> getNotOrderSchoolList(
            IPage<?> page,
            Integer yearPart,
            Integer quarterNum,
            String subjectsId,
            String classTypeId,
            Integer lessonType,
            Integer type,
            Integer status,
            Integer orderType,
            Integer orderSubType,
            String schoolIdStr,
            Long bookTextId,
            Integer bookTextType,
            Integer isDetails,
            Long teacherId,
            Long schoolId,
            Integer yearClassId,
            String teacherName,
            String studentName,
            Long gradeId,
            Integer subscribeType,
            Integer lessonNum
    );

    List<BookClassTypeCountRs> getNotOrderSchoolCountForClassType(Integer yearPart,
                                                                  Integer quarterNum,
                                                                  String subjectsId,
                                                                  String classTypeId,
                                                                  Integer lessonType,
                                                                  Long bookTextId,
                                                                  Integer bookTextType,
                                                                  Integer lessonNum,
                                                                  Integer subscribeType
    );

    IPage<BookSchoolRs> getCancelOrderList(IPage<?> page,
                                           Integer yearPart,
                                           Integer quarterNum,
                                           String subjectsId,
                                           String classTypeId,
                                           Integer lessonType,
                                           String schoolIdStr,
                                           Long bookTextId,
                                           Integer bookTextType,
                                           Integer isDetails,
                                           Long teacherId,
                                           Long schoolId,
                                           Integer yearClassId,
                                           String teacherName,
                                           String studentName,
                                           Long gradeId,
                                           Integer lessonNum,
                                           Integer type
    );

    public abstract List<BookSchoolCountRs> getCancelOrderCountList(Integer yearPart,
                                                                    Integer quarterNum,
                                                                    String subjectsId,
                                                                    String classTypeId,
                                                                    Integer lessonType,
                                                                    String schoolIdStr,
                                                                    Long bookTextId,
                                                                    Integer bookTextType,
                                                                    Integer isDetails,
                                                                    Long schoolId,
                                                                    Long teacherId,
                                                                    Integer yearClassId,
                                                                    Integer lessonNum
    );
}
